/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.gac.gacmod.visual;

import java.awt.Color;
import java.awt.Dimension;
import org.gac.gacmod.model.Step;
import org.netbeans.api.visual.border.BorderFactory;
import org.netbeans.api.visual.layout.LayoutFactory;
import org.netbeans.api.visual.widget.Widget;

/**
 *
 * @author Tomek
 */
public abstract class CompositeStepWidget extends StepWidgetBase
{

    //protected ExpandButtonWidget _expandButton;
    protected Widget _clientAreaBorder;
    protected Widget _clientArea;
    protected Widget _bottomWidget;

    public CompositeStepWidget(BoxScene scene, Step modelStep)
    {
        super(scene, modelStep);
        _headerVFlow.setBorder( BorderFactory.createLineBorder(1));
        _label.setBackground( new Color( 212,244, 255));
        _label.setOpaque(true);
        _clientAreaBorder = new Widget( scene );
        _clientAreaBorder.setLayout(LayoutFactory.createOverlayLayout());
        _clientAreaBorder.setBorder( BorderFactory.createLineBorder(1, new Color( 230, 230, 230 )));
        
        //_clientAreaBorder.setOpaque(true);
        //_clientAreaBorder.setBackground(Color.BLUE);//>

        //this.setBorder(BorderFactory.createLineBorder(1, new Color( 230, 230, 230 )));
        
        _clientArea = new Widget( _scene );
        _clientArea.setLayout(Layouts.VerticalLayout );
        _clientArea.setBorder(BorderFactory.createEmptyBorder(25));
        _clientArea.setMinimumSize(Dimensions.StepMinSize);
        
        _clientAreaBorder.addChild(_clientArea);
        _mainVFlow.addChild(_clientAreaBorder);
        
        //_clientArea.setOpaque(true);//>
        //_clientArea.setBackground(Color.GREEN);//>

        //_mainVFlow.setOpaque(true);
        //_mainVFlow.setBackground( new Color( 212,244, 255));
        
        _bottomWidget = new Widget(scene);
        //_bottomWidget.setMinimumSize(new Dimension( Dimensions.StepMinSize.width , 0));
        _mainVFlow.addChild(_bottomWidget);
        
        //_expandButton = new ExpandButtonWidget(scene, new IExpandButtonListener()
        //{

//            public void ExpandChanged(boolean isExpanded)
//            {
//                _clientAreaBorder.setVisible(isExpanded);
////                for (Widget w : _clientArea.getChildren())
////                {
////                    w.setVisible(isExpanded);
////                }
//            }
//        });
        
//        _headerVFlow.addChild(new ButtonWidget(scene, "+", new IButtonClickListener() {
//
//            public void Click()
//            {
//                ((CompositeStep)_modelStep).AddStep(new ExampleStep("Deferred1"));
//            }
//        }));

        //_headerVFlow.addChild(_expandButton);
        
        //_clientArea.setBorder(BorderFactory.createRoundedBorder(0, 0, Color.WHITE, Color.LIGHT_GRAY));
    }

    public abstract void addInnerStep(StepWidgetBase step);

    public abstract void removeInnerStep( StepWidgetBase step );
}
